# CMakeLists
# Author(s): xuming.Wong <xuming.Wong@gmail.com>

#-----------------------------------------------------------------------------
# 
MESSAGE(STATUS "Project QSThink...")

#-----------------------------------------------------------------------------
MESSAGE(STATUS "Finding Qt4...")
FIND_PACKAGE(Qt4 REQUIRED)

IF(QT4_FOUND)
	MESSAGE(STATUS "Qt4 find.")
	# Set src files
	FILE(GLOB SRC 
	*.cpp 
	
	Control/*.cpp
	
	Core/*.cpp
	
	GUI/*.cpp 
	GUI/Dialog/*.cpp 
	
	Portfolio/*.cpp
	Transaction/*.cpp
	Screener/*.cpp
	
	RichText/*.cpp
	Diagram/*.cpp
	
	Strategy/*.cpp
	Data/*.cpp
	Filter/*.cpp
	
	)
	
	FILE(GLOB MOC_SRC 
	*.h 
	
	Core/*.h
	
	Control/*.h
	
	GUI/*.h 
	GUI/Dialog/*.h 
	
	Portfolio/*.h
	Transaction/*.h
	Screener/*.h
	
	RichText/*.h
	Diagram/*.h
	
	Filter/*.h
	
	)
	
	FILE(GLOB QT_UI_FILES UI/*.ui)
	SOURCE_GROUP("UI" FILES ${QT_UI_FILES})
	
	QT4_WRAP_CPP(QT_MOC_OUT ${MOC_SRC})
	QT4_WRAP_UI(QT_UI_OUT ${QT_UI_FILES})
	
	# External includes
	SET(INC 
		.
		
		Core
		Data
		
		GUI
		GUI/Dialog
		
		Portfolio
		Transaction
		
		
		Control
		Screener
		
		RichText
		Diagram
		
		Strategy
		
		Filter
		
	)
	#Include ui headers produced by qt:
	include_directories(${CMAKE_CURRENT_BINARY_DIR})
	SET(SRC ${SRC} ${QT_MOC_OUT} ${QT_UI_OUT})

	#FILE(READ ${CMAKE_BINARY_DIR}/cmake_libs.txt OUT_LIBS)
	SET(LIB
		qtmaind.lib
		QtCored4.lib
		QtGuid4.lib
		QtNetworkd4.lib
	)
	
	
	BUILD_EXE_Win32(QSThink "${SRC}" "${INC}")
	TARGET_LINK_LIBRARIES(QSThink ${LIB})
	
	SOURCE_GROUP("QT_MOC" FILES ${QT_MOC_OUT})
    SOURCE_GROUP("QT_UI" FILES ${QT_UI_OUT})
	

ENDIF()

